home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-08-06 | 2.4 KB | 85 lines | [TEXT/CWIE] |
- // ===========================================================================
- // CSimpleTCPServer.h ©1995-1998 Metrowerks Inc. All rights reserved.
- // ===========================================================================
-
- #pragma once
-
- #include <LSingleDoc.h>
- #include <LListener.h>
-
- #include <LTCPEndpoint.h>
-
- #include <LCaption.h>
-
- #include "CTCPServerThread.h"
-
- #define kMaxOutstanding 256 //Arbitrarily large number for the qlen param to bind command...
- // I don't think that OT/TCP really cares what this value is
- // as long as it's > 0.
- class CTCPServerThread;
-
- // ===========================================================================
- // • CSimpleTCPServer
- // ===========================================================================
-
- class CSimpleTCPServer : public PP_PowerPlant::LSingleDoc,
- public PP_PowerPlant::LListener {
-
- public:
-
- CSimpleTCPServer(
- LCommander* inSuper);
-
- void ListenToMessage(
- PP_PowerPlant::MessageT inMessage,
- void * ioParam);
-
- virtual PP_PowerPlant::LTCPEndpoint* GetEndPoint() const;
-
- virtual void WaitForConnections(
- UInt32 inListenQueueSize,
- UInt32 inPort);
-
- virtual void CreateServerWindow(
- UInt32 inListenQueueSize,
- UInt32 inPort);
-
- virtual void AddToConnectionCount(short theCount);
-
- virtual void IncRejectionCount();
-
- virtual void BindCompleted();
- virtual void BindFailed();
-
- virtual Boolean IsIdle();
-
- virtual void ServerThreadDied();
-
- virtual void Disconnect();
-
- virtual Boolean AllowSubRemoval(
- LCommander *inSub);
-
- virtual Boolean AttemptQuitSelf(
- SInt32 inSaveOption);
-
- protected:
-
- // this object MUST be created on the heap (we can't do a
- // "delete this" very well with a stack-based object).
- virtual ~CSimpleTCPServer();
-
- PP_PowerPlant::LTCPEndpoint* mEndpoint; // our network endpoint object
- PP_PowerPlant::LCaption* mConnectionCountField; // field used to display current # of connections
- PP_PowerPlant::LCaption* mRejectionCountField; // field used to display current # of rejected connections
- UInt16 mConnectionCount;
- SInt32 mRejectionCount;
-
- CTCPServerThread* mServerThread; // the thread that actually handles the connection
-
- bool mQuitWhenDone; // re-issue quit request when disconnect complete
- SInt32 mSaveOption;
-
- friend class CTCPServerThread;
- };
-